/**
 * @file     TableOutput.h
 * @brief    TableOutput provides the interface create output files for titere

 * @author   Franco Riberi
 * @email    fgriberi AT gmail.com
 *
 * Contents: Header file for TableOutput.
 *
 * System:   titere: Target Ideal TEmperature Rna Expression
 * Language: C++
 *
 * @date     April 2014
 *
 * This file is part of titere.
 *
 * Copyright (C) 2012 - Franco Riberi, FuDePAN.
 *
 * titere is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * titere is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with titere. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef TABLE_OUTPUT_H
#define TABLE_OUTPUT_H

#include <fstream>
#include <biopp/biopp.h>
#include "titere/Types.h"

namespace NSTitere
{

/** @brief Represents the result of compares the structures */
typedef std::string SequenceResult;

/** @brief Represents a file name */
typedef std::string FileName;

/**
 * @brief Responsible to create the output files
 */
class TableOutput
{
public:

    /**
     * @brief Constructor of class parametrized
     *
     * @param tableName The output file name
     */
    TableOutput(const FileName& tableName);

    /**
     * Destructor class
     */
    ~TableOutput();

    /**
     * @brief Save a row
     *
     * @param seqName        The sequence name
     * @param pos            A position in the sequence
     * @param temp           A specific temperature
     * @param unpairedAmount Amount of unpaired nucleotids
     * @param headUnpaired   Amount of unpaired nucleotids in the range [2-8]
     * @param sequence       Input sequence result object
     */
    void save(const std::string& seqName, Position pos, Temperature temp, NucleotidsAmount unpairedAmount,
              NucleotidsAmount headUnpaired, const SequenceResult& sequence);

private:

    /**
     * @brief Writes the header file
     */
    void generateHeader();

    /** @brief File to fill */
    std::ofstream _oFile;
};

} // namespace NSTirere
#endif /* TABLE_OUTPUT_H */
